<template>
    <div class="content-page">
        <div class="content-nav">
            <el-breadcrumb class="breadcrumb" separator="/">
                <el-breadcrumb-item :to="{ name: 'dashboard' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>查看意见反馈及留言</el-breadcrumb-item>
            </el-breadcrumb>
            <div class="operation-nav">
                <el-button type="primary" @click="goBackPage" icon="arrow-left">返回列表</el-button>
            </div>
        </div>
        <div class="content-main">
            <div class="form-table-box">
                <el-form ref="infoForm" :rules="infoRules" :model="infoForm" label-width="120px">

                    <el-form-item label="用户ID" prop="goods_id">
                        <el-input v-model="infoForm.user_id"></el-input>
                    </el-form-item>
                    <el-form-item label="标题" prop="question">
                        <el-input v-model="infoForm.msg_title"></el-input>
                    </el-form-item>
                    <el-form-item label="内容" prop="answer">
                        <el-input type="textarea" v-model="infoForm.msg_content" :rows="10"></el-input>
                        <div class="form-tip"></div>
                    </el-form-item>
                    <el-form-item>
                        <el-button @click="goBackPage">取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "FeedbackAddPage",
        data() {
            return {
                uploaderHeader: {
                    'x-lingang-token': localStorage.getItem('token') || '',
                },
                infoForm: {
                    id: 0,
                    user_id: '',
                    msg_title: '',
                    msg_content: ''
                },
                infoRules: {
                    user_id: [
                        { required: true, message: '请输入商品ID', trigger: 'blur' },
                    ],
                    msg_title: [
                        { required: true, message: '请输入标题', trigger: 'blur' },
                    ],
                    msg_content: [
                        { required: true, message: '请输入内容', trigger: 'blur' },
                    ],
                },
            }
        },
        methods: {
            goBackPage() {
                this.$router.go(-1);
            },
            getInfo() {
                if (this.infoForm.id <= 0) {
                    return false
                }

                //加载商品疑问详情
                let that = this
                this.axios.get('feedback/info', {
                    params: {
                        id: that.infoForm.id
                    }
                }).then((response) => {
                    let resInfo = response.data.data;
                    that.infoForm = resInfo;
                })
            }

        },
        components: {
        },
        mounted() {
            this.infoForm.id = this.$route.query.id || 0;
            this.getInfo();
        }
    }
</script>

<style scoped>

</style>
